package com.hfjava.question.service.impl;

import com.hfjava.question.interfaces.FaqService;
import com.hfjava.question.mapper.FaqMapper;
import com.hfjava.question.pojo.Faq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

//标注业务组件
@org.springframework.stereotype.Service
@Transactional(rollbackFor = {Exception.class})
//在zk服务注册中心上暴露服务接口
@com.alibaba.dubbo.config.annotation.Service(interfaceClass = FaqService.class,version = "1.0.0")
public class FaqServiceImpl implements FaqService {

    @Resource
    private FaqMapper faqMapper;

    public List<Faq> findFaqByTitleLike(String title) {
        return faqMapper.selectFaqByTitleLike(title);
    }

    public Faq findFaqById(Integer qid) {
        return faqMapper.selectFaqById(qid);
    }

    public Integer addFaq(Faq faq) {
        return faqMapper.insertFaq(faq);
    }
}
